Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Zarr chunks refactor #4550

Closed
wants to merge 52 commits into from
Closed

WIP: Zarr chunks refactor #4550

wants to merge 52 commits into from

Conversation

aurghs
Copy link
Collaborator

@aurghs aurghs commented Oct 29, 2020

This work aims to harmonize the way zarr deals with chunking to have similar behavior for all other backends and unify the code.
Most of the changes involve the new API, apiv2.py, except for some changes in the code that has been added with the merge of #4187.

main changes:

  • refactor apiv2.dataset_from_backend_dataset function.
  • move get_chunks from zarr to dataset.

current status:

  • in apiv2.open_dataset chunks='auto' and chunks={} now has the same beahviuor
  • in apiv2.open_dataset for all the backends now the default chunking is provided by the backend, if it is not available it uses one big chunk.

Missing points:

  • standardize the key in encodings to define the on-disk chunks: chunksizes
  • add a specific key in encodings for preferred chunking (currently it is used chunks)

There is one open point to be discussed yet: dataset.chunks and open_dataset(..., chunks=...) have different behaviors.
dataset.chunks(chunks={}) opens the dataset with only one chunk per variable, while in open_dataset(..., chunks={}) it uses encodings['chunks'], when available.

Note that also chunks=None has a different behaviour: open_dataset(..., chunks=None) (or open_dataset(...), it's the deafult) returns variables without chunks, while dataset.chunk(chunks=None) (or dataset.chunk(), it's the default) has the same behavior of dataset.chunk(chunks=None). Probably it's not worth changing it.

aurghs and others added 30 commits September 25, 2020 19:07
# Conflicts:
#	xarray/backends/api.py
…ad-refactor

# Conflicts:
#	xarray/backends/apiv2.py
- to be used in apiv2 without instantiate the object
- modify signature
- move default setting inside backends
@pep8speaks
Copy link

pep8speaks commented Oct 29, 2020

Hello @aurghs! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 1:1: F401 'warnings' imported but unused

Comment last updated at 2020-11-02 12:07:00 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants